#include "threadpool.hpp"
#include <iostream>

using namespace ThreadPoolModule;

using task = std::function<void(std::string)>;
void Test(int num,std::string name)
{
    std::cout<<"线程: "<<name<<" 执行完毕！"<<"任务编号为: "<<num<<std::endl;
    sleep(2);
}
int main()
{
   ThreadPool<task>::GetInstance()->start();
    int n = 10;
    while(n--)
    {
        ThreadPool<task>::GetInstance()->Enqueue(std::bind(&Test,n,std::placeholders::_1));
    }
    ThreadPool<task>::GetInstance()->stop();
    ThreadPool<task>::GetInstance()->wait();
    return 0;
}